#define _CRT_SECURE_NO_DEPRECATE
#include "input_data.h"
#include <cstring>

void input_data::create_logfile(){
  char logname[100];
  sprintf(logname, "r%d%s.log", ROOT_LENGTH, (ADD_X3) ? "+x3" : "");
  logfile = fopen(logname, "w");
}

void input_data::dump_input() const{
  dump("Calculating answer for test:\n");
  dump("Root length <= %d\nPattern X^3 IS %s forbidden\n", ROOT_LENGTH, (ADD_X3) ? "" : "NOT");
  dump("\nPrecision = %.20lf\n\n", delta);
}

void input_data::dump(const char *str, ...) const{
  va_list args;
  va_start(args, str);
  vfprintf(logfile, str, args);
  fflush(logfile);
  va_end(args);
}
